package com.cd.mc.config;

import com.cd.mc.service.BeanService;
import com.cd.mc.service.EnrollService;
import com.cd.mc.service.impl.BeanServiceImpl;
import com.cd.mc.service.impl.EnrollServiceImplExt;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration("beanConfig")
public class BeanConfig {

    @Bean
    public BeanService BeanService()
    {
        return new BeanServiceImpl();
    }

    @Bean
    public RestTemplate restTemplate()
    {
        return new RestTemplate();
    }

//    @Bean({"userService"})
//    public RemoteServiceProxyFactoryBean<UserService> userService() {
//        RemoteServiceProxyFactoryBean<UserService> remoteServiceProxyFactoryBean = new RemoteServiceProxyFactoryBean();
//        remoteServiceProxyFactoryBean.setClient(this.discoveryClient);
//        remoteServiceProxyFactoryBean.setEnabled(true);
//        remoteServiceProxyFactoryBean.setRemoteHostAddress(this.clientName);
//        remoteServiceProxyFactoryBean.setRmiFactory(!this.useHttpInvoker);
//        remoteServiceProxyFactoryBean.setLocalBeanClass(EmptyUserServiceImpl.class);
//        remoteServiceProxyFactoryBean.setServiceUrl(this.useHttpInvoker ? "http://@{serverIpAddress}:@{serverPort}/user/UserService" : "rmi://@{serverIpAddress}:@{serverPort}/UserService");
//        remoteServiceProxyFactoryBean.setTargetApplicationName("datablau_usermgmt");
//        remoteServiceProxyFactoryBean.setServiceInterface(UserService.class);
//        remoteServiceProxyFactoryBean.setServerRefreshInterval(10000L);
//        return remoteServiceProxyFactoryBean;
//    }
}
